//
//  collecAndDownloadTableViewCell.m
//  YanMusicPlayer
//
//  Created by 1564335 on 15-6-17.
//  Copyright (c) 2015年 胡岩 All rights reserved.
//

#import "collecAndDownloadTableViewCell.h"

@implementation collecAndDownloadTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.singerName = [[UILabel alloc] init];
        [self.contentView addSubview:self.singerName];
        self.musicName = [[UILabel alloc] init];
        [self.contentView addSubview:self.musicName];
        self.collectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.contentView addSubview:self.collectBtn];
    }
    return self;
}

- (void)setMusicModel:(MusicModel *)musicModel
{
    _musicModel = musicModel;
    if (_musicModel.singerName != nil && ![_musicModel.singerName isEqual:[NSNull null]]) {
        _singerName.text = _musicModel.singerName;
        _singerName.font = [UIFont systemFontOfSize:11];
    }
    _musicName.text = _musicModel.songName;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _collectBtn.frame = CGRectMake(10, 2, self.frame.size.height - 4, self.frame.size.height - 4);
    //    _collectBtn.backgroundColor = [UIColor yellowColor];
    _musicName.frame = CGRectMake(70, 10, self.frame.size.width - self.frame.size.height - 70, (self.frame.size.height - 30) / 3 * 2);
    _singerName.frame = CGRectMake(70, _musicName.frame.size.height + 20, self.frame.size.width - self.frame.size.height - 70, (self.frame.size.height - 30) / 3 + 5);
    
    _collectBtn.showsTouchWhenHighlighted = YES;
    [_collectBtn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@", _collectImage]]forState:UIControlStateNormal];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
